<form action="/svn/register/" method="post" id="reg_form">{% csrf_token %}
	{{ registerform.as_p }}
	<p id="5559" style="display: none">Username has been used.</p>
	<p id="5560" style="display: none">Email has been used.</p>
	<input class="btn btn-primary" type="submit" value="Register"/>
	<button class="btn" type="button" id="register_login_close">Close</button>
</form>
<hr>

<p>Note: You need admin to grant you writable access before <br>being able to modify any file.</p>

<script>
	$('#reg_form').submit(function(e){
		//var validlogin = false;
		$.ajax({
			type: "POST",
			url: "/svn/register/",
			data: $('#reg_form').serialize(),
			success: function(msg){
				//window.location = msg
				if(msg=="5559"){
					clearMessage();
					err5559 = document.getElementById('5559');
					err5559.style.display = 'block';
				}
				if(msg=="5560"){
					clearMessage();
					err5560 = document.getElementById('5560');
					err5560.style.display = 'block';
				}
				if(msg=="OK"){
					window.location = "/svn/";
				}
			}
		});
		e.preventDefault();
	});
	function clearMessage(){
		err5559 = document.getElementById('5559');
		err5560 = document.getElementById('5560');
		err5559.style.display = 'none';
		err5560.style.display = 'none';
	}
</script>